#include <stdio.h>

static unsigned long test[] ={
	0x000000000000000a,
	0x000000000000001a,
	0x000000000000012a,
	0x000000000000123a,
	0x000000000001234a,
	0x000000000012345a,
	0x000000000123456a,
	0x000000001234567a,
	0x000000012345678a,
	0x000000123456789a,
	0x000001234567890a,
	0x000000000000000b,
	0x000000000000001b,
	0x000000000000012b,
	0x000000000000123b,
	0x000000000001234b,
	0x000000000012345b,
	0x000000000123456b,
	0x000000001234567b,
	0x000000012345678b,
	0x000000123456789b,
	0x000001234567890b,
	0x000000000000000c,
	0x000000000000001c,
	0x000000000000012c,
	0x000000000000123c,
	0x000000000001234c,
	0x000000000012345c,
	0x000000000123456c,
	0x000000001234567c,
	0x000000012345678c,
	0x000000123456789c,
	0x000001234567890c,
	0x000000000000000d,
	0x000000000000001d,
	0x000000000000012d,
	0x000000000000123d,
	0x000000000001234d,
	0x000000000012345d,
	0x000000000123456d,
	0x000000001234567d,
	0x000000012345678d,
	0x000000123456789d,
	0x000001234567890d,
	0x000000000000000e,
	0x000000000000001e,
	0x000000000000012e,
	0x000000000000123e,
	0x000000000001234e,
	0x000000000012345e,
	0x000000000123456e,
	0x000000001234567e,
	0x000000012345678e,
	0x000000123456789e,
	0x000001234567890e,
	0x000000000000000f,
	0x000000000000001f,
	0x000000000000012f,
	0x000000000000123f,
	0x000000000001234f,
	0x000000000012345f,
	0x000000000123456f,
	0x000000001234567f,
	0x000000012345678f,
	0x000000123456789f,
	0x000001234567890f,
        /* min and max */
	0x000002147483647c,
	0x000002147483648d,

/* fixs390: we also need to check if invalid values cause a fixed-point-devide exception.
   Not yet implemented. */
/*	0x000002147483648c,
	0x000002147483649d,
	0x00000000000000fa, */

};


static signed int dec_to_hex(unsigned long *addr)
{
        register signed int res asm("2") = 0;
        register unsigned long *_addr asm("4") = addr;

        asm volatile(
        "       cvb %0,0(0,%1)"
                : "=d" (res) : "d" (_addr) : "memory");
        return res & 0xffffffff;
}




int main()
{
	int i;

	for (i = 0; i < sizeof(test) / sizeof(test[0]); i++)
	printf("%d\n", dec_to_hex(&test[i]));
	return 0;
}
